//
//  QXBenYueQiXingViewController.m
//  qiJi
//
//  Created by 凤利史 on 2018/4/8.
//  Copyright © 2018年 sunrose. All rights reserved.
//

#import "QXBenYueQiXingViewController.h"
#import "QXQingXingTableViewCell.h"
@interface QXBenYueQiXingViewController ()<UITableViewDelegate , UITableViewDataSource>
@property(nonatomic,strong) UITableView *tableView;
@property (nonatomic, strong) UILabel *titleLab;//公里数

@end

@implementation QXBenYueQiXingViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
    
}
//设置顶部20的部分字体颜色变为白色
- (UIStatusBarStyle)preferredStatusBarStyle{
    
    return UIStatusBarStyleLightContent;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self creationView];
    [self regeditCell];
    
    
    // Do any additional setup after loading the view.
}
- (void)creationView{
    
    UIView *view = [[UIView alloc] init];
    [self.view addSubview:view];
    view.frame = CGRectMake(0, 0, DEF_SCREEN_WIDTH, (KIsiPhoneX?84:64)+170);
    view.backgroundColor = getColor(@"7C8187");
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    UILabel *titlelabel = [[UILabel alloc] init];
    [view addSubview:titlelabel];
    [titlelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(view).with.offset(35);
        make.centerX.equalTo(view);
    }];
    
    titlelabel.text = @"本月骑行距离";
    
    titlelabel.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:16];
    
    titlelabel.textColor = [UIColor whiteColor];
    
    
    UIImage *im = [UIImage imageNamed:@"common_back_btn"];
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(20, 35, im.size.width, im.size.height);
    [leftBtn setBackgroundImage:[UIImage imageNamed:@"common1_back_btn"] forState:UIControlStateNormal];
    [leftBtn setBackgroundImage:[UIImage imageNamed:@"common1_back_btn"] forState:UIControlStateSelected];
    [leftBtn addTarget:self action:@selector(leftNavItemClick) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:leftBtn];
    self.titleLab = [[UILabel alloc] init];
    [view addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(view);
        make.top.equalTo(titlelabel.mas_bottom).with.offset(45);
        
        
    }];
    self.titleLab.text = @"0.00";
    self.titleLab.textColor = [UIColor whiteColor];
    self.titleLab.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:38];
    UILabel *gongLiLab = [[UILabel alloc] init];
    [view addSubview:gongLiLab];
    [gongLiLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(view);
        make.top.equalTo(self.titleLab.mas_bottom).with.offset(10);
        
        
    }];
    gongLiLab.text = @"公里 (km)";
    gongLiLab.textColor = [UIColor whiteColor];
    gongLiLab.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:14];
    
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, (KIsiPhoneX?84:64)+170, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - (KIsiPhoneX?84:64)-170)];
    _tableView.backgroundColor = [UIColor whiteColor];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_tableView];
    
    
}
- (void)regeditCell{
    
    
    
    [self.tableView registerNib:[UINib nibWithNibName:@"QXQingXingTableViewCell" bundle:nil] forCellReuseIdentifier:@"QXQingXingTableViewCell"];
    
}

#pragma mark --- UITableViewDelegate ---

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 84;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
}

#pragma mark --- UITableViewDataSource ---

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 11;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    QXQingXingTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"QXQingXingTableViewCell" forIndexPath:indexPath];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    
    return cell;
}


//返回前一页
-(void)leftNavItemClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
